<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		// $stem = new Entities\Stem;
		
		// $stem->setName('bastschade'); // bastschade, maaischade
		// $stem->setActive(1);
		
		// $this->doctrine->em->persist($stem);
		// $this->doctrine->em->flush();
		
		// $validator = new Symfony\Component\Validator\Validator;
		
		// $stem = $this->doctrine->em->find('Entities\Stem', 1);

		
		// $stem->setName('eppiedraaklelijk');
		
		// var_dump($stem);


   /*
     $criteria = array();
        $orderBy = array('name' => 'ASC');

        $stems = $this->doctrine->em->getRepository('Entities\Stem')->findBy(array(), $orderBy);
        
        var_dump($stems);
*/
	
        $tree = $this->doctrine->em->find('Entities\Tree', 2);
        
/*         var_dump($tree); */

        self::show($tree->getPlantdate());
        self::show($tree->getHeight());
        
        self::show($tree->getLocation()->getLatitude());
		
		self::show($tree->getTreespecie()->getLatinname());
		
		$this->load->view('welcome_message');
		
	}
	
	
	
	private function test()
	{
		$this->load->view('welcome_message');
	}
	
	
	
	    /**
     * public static function show
     * Prints the variable passed into this function, when the boolean $bShowType is true, then the type of the variable will also be shown.
     *
     * @author      Jeroen Sen <jeroensen@planet.nl>
     * @version     20080707
     * @param       variant $vVariant
     * @param       boolean $sShowType
     * @return      void
     *
     */
     public static function show($vVariant, $sShowType = true, $bPrint = true)
     {
         $aBacktrace = debug_backtrace();

         $aFilearray = explode("/", $aBacktrace[0]['file']);

         $sFilename = "[".$aFilearray[(count($aFilearray)-1)]." : ".$aBacktrace[0]['line']."] => ";

         $sType = gettype($vVariant);

         $sReturn = '';

         switch($sType) {
             case "object":
             case "array":
                 $sReturn = $sFilename . ($sShowType ? '['.$sType.'] ' : '') . '<pre>' . print_r($vVariant, true) . '</pre><br/>';
                 break;
             case "boolean":
                 $sReturn = $sFilename . ($sShowType ? '['.$sType.'] ' : '') . (($vVariant) ? "true" : "false") .'<br/>';
                 break;
             case "string":
             case "integer":
             default:
                 $sReturn = $sFilename . ($sShowType ? '['.$sType.'] ' : '') . $vVariant .'<br/>';
                 break;
         }

         if ($bPrint === true) {
             print($sReturn);
         } else {
         	 return $sReturn;
         }

     } // public static function show($vVariant)
	
	
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */